import api from '@/api/index'
import { userService } from '@/utils/apiConfig'
// 分页查询信息
export const getUserList = <T>(data?: unknown) => {
  return api.get<T>(userService + '/users', data)
}
// 不分页查询信息
export const getUserAllList = <T>(data?: unknown) => {
  return api.get<T>(userService + '/users/list', data)
}
// 修改用户
export const editSubmit = <T>(id: string, data?: unknown) => {
  return api.put<T>(userService + '/users/' + id, data)
}
// 新增用户
export const addSubmit = <T>(data?: unknown) => {
  return api.post<T>(userService + '/users', data)
}
// 校验手机号重复
export const validatePhoneExist = <T>(data?: unknown) => {
  return api.get<T>(userService + '/users/checkUserPhoneEnabled', data)
}
// 校验用户工号重复
export const validateCodeExist = <T>(data?: unknown) => {
  return api.get<T>(userService + '/users/checkUserEmployeeIdEnabled', data)
}
// 获取用户详情
export const getDetailById = <T>(id: string) => {
  return api.get<T>(userService + '/users/' + id)
}
// 删除用户
export const deleteUser = <T>(id: string, data?: unknown) => {
  return api.delete<T>(userService + '/users/' + id, data)
}
// 重置密码
export const resetPwdById = <T>(id: string) => {
  return api.put<T>(userService + `/users/${id}/resetPassword`)
}
// 部门迁移
export const changeDepart = <T>(data?: unknown) => {
  return api.put<T>(userService + '/users/changeDepart', data)
}
